package com.example.demo.constants;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author Capital Letters
 * @title: EmailConfigConstants
 * @projectName oj-homework
 * @description: TODO
 * @date 2023/4/2017:08
 */
@Component
public class EmailConfigConstants implements InitializingBean {
    @Value("${tencent.sms.region}")
    private String region;

    @Value("${tencent.sms.secret_id}")
    private String secretId;

    @Value("${tencent.sms.secret_key}")
    private String secretKey;

    @Value("${tencent.sms.endpoint}")
    private String endpoint;

    @Value("${tencent.sms.register_template_id}")
    private Long registerTemplateId;

    @Value("${tencent.sms.forget_password_template_id}")
    private Long forgetPasswordTemplateId;

    @Value("${tencent.sms.from_email}")
    private String fromEmail;

    private String registerSubject = "湘潭大学OJ系统用户注册";

    private String forgetPasswordSubject = "湘潭大学OJ系统用户忘记密码";

    public static String REGION;
    public static String SECRET_ID;
    public static String SECRET_KEY;
    public static String ENDPOINT;
    public static String FROM_EMAIL;
    public static Long   FORGET_PASSWORD_TEMPLATE_ID;
    public static Long   REGISTER_TEMPLATE_ID;
    public static String  REGISTER_SUBJECT;
    public static String   FORGET_PASSWORD_SUBJECT;


    @Override
    public void afterPropertiesSet() throws Exception {
        REGION = region;
        SECRET_ID = secretId;
        SECRET_KEY = secretKey;
        ENDPOINT = endpoint;
        FROM_EMAIL = fromEmail;
        FORGET_PASSWORD_TEMPLATE_ID = forgetPasswordTemplateId;
        REGISTER_TEMPLATE_ID = registerTemplateId;
        REGISTER_SUBJECT = registerSubject;
        FORGET_PASSWORD_SUBJECT = forgetPasswordSubject;
    }
}
